package com.ss.android.article.base.feature.detail2.picgroup;

import android.widget.AbsListView;
import android.widget.ListView;
import com.ss.android.common.util.NetworkUtils;

final class d implements AbsListView.OnScrollListener {
    private final GalleryFragment a;

    d(GalleryFragment arg1) {
        this.a = arg1;

    }

    public final void onScroll(AbsListView arg7, int arg8, int arg9, int arg10) {
        int v2 = 0;
        com.ss.android.article.base.feature.detail2.picgroup.a.a v3 = this.a.i;
        if(v3 != null) {
            this.a.a(v3);
            int v4 = arg8 + arg9;
            GalleryFragment v5 = this.a;
            boolean v0 = v4 <= ((ListView)arg7).getHeaderViewsCount() || v3.mListView.getScrollY() <= 0 ? false : true;
            v5.m = v0;
            if(!this.a.n && (this.a.m)) {
                v3.mNewDetailAdapter.notifyDataSetChanged();
                this.a.n = true;
            }

            if(v4 < arg10) {
                return;
            }

            if(arg10 <= ((ListView)arg7).getHeaderViewsCount() + ((ListView)arg7).getFooterViewsCount()) {
                return;
            }

            if(!NetworkUtils.isNetworkAvailable(this.a.o)) {
                return;
            }

            GalleryFragment v0_1 = this.a;
            if(v3 == null || v3.i == null || (v0_1.p()) || (v3.i.load[0]) || !v3.i.mArticleTabComments[0].hasMore) {
                v2 = -1;
            }

            if(v2 < 0) {
                return;
            }

            this.a.H();
        }
    }

    public final void onScrollStateChanged(AbsListView arg1, int arg2) {
    }
}

